package com.neural.neighbourhood;

import java.util.List;

import com.neural.descriptor.Point;
import com.neural.descriptor.SizeDescriptor;

public abstract class Neighbourhood {

	private final String name;

	public Neighbourhood(String name) {
		this.name = name + "Neighbourhood";
	}

	public String getName() {
		return name;
	}

	public abstract List<Point> getPointsFor(Point point, SizeDescriptor size, Integer neighbourSize);

	protected void addIfCan(List<Point> points, Point point, SizeDescriptor size, int dx, int dy) {
		if (point.getXPos() + dx >= 0 && point.getXPos() + dx <= size.getSizeX() - 1 && point.getYPos() + dy >= 0 && point.getYPos() + dy <= size.getSizeY() - 1) {
			points.add(new Point(point.getXPos() + dx, point.getYPos() + dy));
		}
	}
}